home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE15 / EXECFILE / EXECFILE.ZIP / EXAMPLE.ZIP / UNIT1.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1996-07-14  |  2.8 KB  |  107 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Buttons, Execfile, StdCtrls, ExtCtrls, ShellAPI;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     ExecFile1: TExecFile;
  12.     SpeedButton1: TSpeedButton;
  13.     SpeedButton2: TSpeedButton;
  14.     Label1: TLabel;
  15.     WaitBox: TCheckBox;
  16.     WaitMethod: TRadioGroup;
  17.     Ass: TCheckBox;
  18.     Edit1: TEdit;
  19.     PriorityType: TRadioGroup;
  20.     WinStyle: TRadioGroup;
  21.     Label2: TLabel;
  22.     Label3: TLabel;
  23.     SpeedButton3: TSpeedButton;
  24.     OpenDialog1: TOpenDialog;
  25.     procedure SpeedButton1Click(Sender: TObject);
  26.     procedure ExecFile1Fail(Sender: TObject);
  27.     procedure WaitBoxClick(Sender: TObject);
  28.     procedure WaitMethodClick(Sender: TObject);
  29.     procedure AssClick(Sender: TObject);
  30.     procedure PriorityTypeClick(Sender: TObject);
  31.     procedure WinStyleClick(Sender: TObject);
  32.     procedure SpeedButton2Click(Sender: TObject);
  33.     procedure SpeedButton3Click(Sender: TObject);
  34.   private
  35.     { Private declarations }
  36.   public
  37.     { Public declarations }
  38.   end;
  39.  
  40. var
  41.   Form1: TForm1;
  42.  
  43. implementation
  44.  
  45. {$R *.DFM}
  46.  
  47. procedure TForm1.SpeedButton1Click(Sender: TObject);
  48. begin
  49. ExecFile1.CommandLine := Edit1.Text;
  50. ExecFile1.Parameters := '';
  51.  
  52. Label1.Caption := 'Waiting';
  53. If ExecFile1.Execute then Label1.Caption := 'Done';
  54. end;
  55.  
  56. procedure TForm1.ExecFile1Fail(Sender: TObject);
  57. begin
  58. Label1.Caption := 'Error->  '+IntToStr(ExecFile1.ErrorCode);
  59. end;
  60.  
  61. procedure TForm1.WaitBoxClick(Sender: TObject);
  62. begin
  63. If WaitBox.Checked then ExecFile1.Wait := True else
  64. begin ExecFile1.StopWaiting; ExecFile1.Wait := False; end;
  65. end;
  66.  
  67. procedure TForm1.WaitMethodClick(Sender: TObject);
  68. begin
  69. If WaitMethod.ItemIndex = 0 then ExecFile1.WaitStyle := wRegular else
  70. ExecFile1.WaitStyle := wSuspend;
  71. end;
  72.  
  73. procedure TForm1.AssClick(Sender: TObject);
  74. begin
  75. If Ass.Checked then ExecFile1.Associate := True else
  76. ExecFile1.Associate := False;
  77.  
  78. end;
  79.  
  80. procedure TForm1.PriorityTypeClick(Sender: TObject);
  81. begin
  82. If PriorityType.ItemIndex = 0 then ExecFile1.Priority := pcIdle;
  83. If PriorityType.ItemIndex = 1 then ExecFile1.Priority := pcNormal;
  84. If PriorityType.ItemIndex = 2 then ExecFile1.Priority := pcHigh;
  85. If PriorityType.ItemIndex = 3 then ExecFile1.Priority := pcRealTime;
  86.  
  87. end;
  88.  
  89. procedure TForm1.WinStyleClick(Sender: TObject);
  90. begin
  91. If WinStyle.ItemIndex =0 then ExecFile1.WindowStyle := wsNorm;
  92. If WinStyle.ItemIndex =1 then ExecFile1.WindowStyle := wsMaximize;
  93. If WinStyle.ItemIndex =2 then ExecFile1.WindowStyle := wsMinimize;
  94. end;
  95.  
  96. procedure TForm1.SpeedButton2Click(Sender: TObject);
  97. begin
  98. ExecFile1.Terminate;
  99. end;
  100.  
  101. procedure TForm1.SpeedButton3Click(Sender: TObject);
  102. begin
  103. If OpenDialog1.Execute then Edit1.Text := OpenDialog1.Filename;
  104. end;
  105.  
  106. end.
  107.